#ifndef VECTOR3D_H
#define VECTOR3D_H

#include "common.h"

typedef struct {
    double x, y, z;
} Vector3D;

// 向量基本操作
Vector3D vector3d_create(double x, double y, double z);
Vector3D vector3d_add(Vector3D a, Vector3D b);
Vector3D vector3d_sub(Vector3D a, Vector3D b);
Vector3D vector3d_scale(Vector3D v, double scalar);
double vector3d_dot(Vector3D a, Vector3D b);
Vector3D vector3d_cross(Vector3D a, Vector3D b);
double vector3d_magnitude(Vector3D v);
Vector3D vector3d_normalize(Vector3D v);
Vector3D vector3d_negate(Vector3D v);

// 特殊向量
Vector3D vector3d_zero();
Vector3D vector3d_i();
Vector3D vector3d_j();
Vector3D vector3d_k();

// 高级操作
double vector3d_distance(Vector3D a, Vector3D b);
Vector3D vector3d_lerp(Vector3D a, Vector3D b, double t);
bool vector3d_equal(Vector3D a, Vector3D b, double tolerance);

// 打印
void vector3d_print(const char* name, Vector3D v);

#endif // VECTOR3D_H
